package com.spzx.product.api;

import com.spzx.common.core.domain.R;
import com.spzx.product.domain.vo.SkuLockVo;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Package: com.spzx.product.api
 *
 * @author xiongkunYang
 * @description:
 * @since 2025/6/7 8:19
 */
@Component
public class RemoteSkuStockFallbackFactory implements FallbackFactory<RemoteSkuStockService> {
    @Override
    public RemoteSkuStockService create(Throwable cause) {
        return new RemoteSkuStockService() {
            @Override
            public R<String> checkAndLockStock(String orderNo, List<SkuLockVo> skuLockVoList, String source) {
                return R.fail("检查和锁定库存失败：" + cause.getMessage());
            }
        };
    }
}